Install Python and Visual Studio Code (Mac) — Interactive Checklist Form
Objective
This guide explains, step by step, how to install:
- Python
- Visual Studio Code (VS Code)
- The Python extension for VS Code
- A simple test program to confirm everything is working
Review Information
Before You Start
You need:
- A Mac computer
- Internet access
- Permission to install software
It is a good idea to close unnecessary programs before starting.
Step 1 — Download Python
Open your web browser.
Download the latest Python installer for macOS.
Wait for the
.pkgfile to finish downloading.
Step 2 — Install Python
Open the downloaded Python
.pkginstaller.Click Continue through the installation steps.
Click Install.
Enter your Mac password if asked.
Wait for installation to complete.
Click Close when finished.
Step 3 — Verify Python Installation
Open Terminal.
- Open Finder
- Go to Applications > Utilities
- Open Terminal
Type:
python3 --version- Press Return.
You should see something like:
Python 3.x.x- Also test pip by typing:
pip3 --versionStep 4 — If Python Does Not Work
If python3 is not found:
Close Terminal.
Install Python again from python.org.
Open a new Terminal window.
Test again with:
python3 --versionStep 5 — Download Visual Studio Code
Open your web browser.
Click Download for Mac.
Wait for the file to download.
Step 6 — Install Visual Studio Code
Open the downloaded VS Code file.
Drag Visual Studio Code into the Applications folder.
Open Applications.
Double-click Visual Studio Code.
If macOS shows a security message, click Open.
Step 7 — Install the code Command in Terminal
Open VS Code.
Press:
Cmd + Shift + P
- Type:
Shell Command: Install 'code' command in PATH
- Click the command.
This allows you to open folders from Terminal using code ..
Step 8 — Install the Python Extension
In VS Code, click the Extensions icon on the left.
In the search box, type:
Python
Find Python by Microsoft.
Click Install.
Step 9 — Open a Working Folder
In VS Code, click File > Open Folder.
Create or choose a folder for Python work.
Example:
/Users/YourName/Documents/Python-Projects
- Click Open.
Step 10 — Create a Test Python File
In VS Code, click File > New File.
Save the file as:
test.py
- Add the following code:
print("Hello Yahya - Python is working on Mac!")- Save the file.
Step 11 — Select the Python Interpreter
- Press:
Cmd + Shift + P
- Type:
Python: Select Interpreter
Click it.
Select the installed Python 3 interpreter.
Step 12 — Run the Test Program
You can run the file in either of these ways.
Option B — Run from Terminal
In VS Code, click Terminal > New Terminal.
Type:
python3 test.py- Press Return.
Expected result:
Hello Yahya - Python is working on Mac!
Step 13 — Install Common Python Packages
In the VS Code terminal, type:
pip3 install pandas matplotlib numpy openpyxlPress Return.
Step 14 — Check Installed Packages
To confirm installation, type:
pip3 listLook for packages such as:
- pandas
- matplotlib
- numpy
- openpyxl
Step 15 — Optional: Install Homebrew
Homebrew is a package manager for Mac.
To install Homebrew, open Terminal and run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"After Homebrew is installed, you can also install Python using:
brew install pythonCheck it with:
python3 --versionStep 16 — Useful Mac Notes
- On Mac, use
python3instead ofpythonin most cases. - On Mac, use
pip3instead ofpipin most cases. - If VS Code does not immediately find Python, restart VS Code.
- If Terminal does not see the new installation, close and reopen Terminal.
Troubleshooting
Problem 1 — python3 not recognized
Fix:
- Reinstall Python from python.org
- Open a new Terminal window
- Test again
Problem 2 — VS Code cannot find interpreter
Fix:
- Press
Cmd + Shift + P - Select
Python: Select Interpreter - Choose the correct Python 3 version
Problem 3 — Permission error with pip
Try:
pip3 install --user pandas matplotlib numpy openpyxlProblem 4 — code command not found
Fix:
- Open VS Code
- Run
Shell Command: Install 'code' command in PATH - Restart Terminal
Summary
You have now completed the following:
- Installed Python on Mac
- Installed Visual Studio Code
- Installed the Python extension
- Enabled the
codecommand - Selected the Python interpreter
- Created and ran a test Python file
- Installed common Python packages
Next Suggested Step
Create a second file named:
hello.py
Add:
name = input("What is your name? ")
print("Hello", name)Then run:
python3 hello.py